﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CRMSimple.LogService.Configuration.SQLDBConfiguration;
using BitAuto.EP.CRMLogSystem.Entity;
using BitAuto.EP.CRMLogSystem.DAL;

namespace BitAuto.EP.CRMLogSystem.BLL
{
    public class SQLDBConfigurationBLL
    {
        SQLDBConfigurationDAL dal = new SQLDBConfigurationDAL();
        public IList<LogTableInfo> GetConfiguration()
        {
             IList<LogTableInfo> dic = new List<LogTableInfo>();
             var res = dal.GetLogTableInfo();
             var fileds = dal.GetLogFieldInfo();
             if (res != null && res.Any())
             {
                 foreach (var table in res)
                 {
                     table.Fileds = new List<LogFieldInfo>();
                     foreach (var item in fileds)
                     {
                         if (item.LogTableId.Equals(table.LogTableId))
                         {
                             table.Fileds.Add(item);
                         }
                     }
                     dic.Add(table);
                 }
             }
            return dic;
        }


    }
}
